package com.chcplayer.ui
{
import com.chcplayer.ChcPlayerApp;
import com.chcplayer.enums.FormCloseType;

import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;

/**
 * author yh
 */
public class SetScalingWindow extends BaseWindow
{
	/**
	 */
	private var m_ttf:TextField = new TextField();
	/**
	 */
	public function SetScalingWindow()
	{
		super("设置比例", 250, 150);
		/*
		*/
		p_btnOK.y = 80;
		this.addChild(p_btnOK);
		/*
		*/
		m_ttf.width = 200;
		m_ttf.height = 30;
		m_ttf.restrict = "0-9.";
		m_ttf.background = true;
		m_ttf.defaultTextFormat = new TextFormat("Microsoft YaHei", 20);
		/*
		*/
		m_ttf.type = TextFieldType.INPUT;
		m_ttf.x = p_btnOK.x + 2;
		m_ttf.y = 20;
		this.addChild(m_ttf);
	}
//==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
// protected
//==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
	/**
	 */
	override protected function _OnShow():void
	{
		m_ttf.text = String(p_obApp.getScaling());
		this.stage.focus = m_ttf;
	}
	/**
	 */
	override protected function _OnClose():void
	{
		if ( FormCloseType.CONFIRM == p_strCloseFlag )
		{
			var nScaling:Number = Number(m_ttf.text);
			if ( !isNaN(nScaling) )
			{
				if ( nScaling > 0 && nScaling < 64 )
				{
					p_obApp.setScaling(nScaling);
				}
			}
		}
	}
	/**
	 */
}
}